<?php
class App_Module_Admin_Component_Blogs_Ctrl_Http extends App_Module_Admin_Component_Articles_Ctrl_Http
{
	protected $_bpage;

    protected function GetBlogQueryPage()
    {
    	if (Mozg::Request('http')->hasQuery('bpage'))
    	{
			$this->_bpage = (int)Mozg::Request('http')->getQuery('bpage');
			if ($this->_bpage != Mozg::Request('http')->getCookie('bpage'))
			{
		       	$link = Mozg_Router::Get('http')->Create(array('module' => 'admin', 'ctrl' => 'blogs'));
				Mozg::Request('http')->SetCookie('bpage', $this->_bpage, 0, $link);
			}
    	}
    	else
    	{
    		$this->_bpage = (int)Mozg::Request('http')->getCookie('bpage');
    	}

    	return $this->_bpage;
    }
	
    protected function GetBlogFromQueryId()
    {
    	if ($this->_blog !== null) return $this->_blog;

		$blogId = (int)Mozg::Request('http')->get('blog');
		if ($blogId)
		{
			$this->_blog = Mozg_Mapper::Get('Blogs')->GetOne(array('id' => $blogId));
		}
		else
		{
			$this->_blog = false;
		}
		
		return $this->_blog;
    }
}